package at.ac.lbg.media.vis.framework.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

import at.ac.lbg.media.vis.framework.model.ArtworkDetails;
import at.ac.lbg.media.vis.framework.service.IThemeService;

public class DetailsController extends AbstractCommandController {
	
	protected final Log logger = LogFactory.getLog(getClass());
	private IThemeService themeService;
	private int id = 2171;

	public DetailsController() {
		super(String.class, "command");
	}


	@Override
	protected ModelAndView handle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2,
			BindException arg3) throws Exception {
		ModelAndView mav = new ModelAndView("details");
		ArtworkDetails ad = themeService.getArtworkDetails(id);

		mav.addObject("ad", ad);
		
		logger.debug("##################### details handle");
		return mav;
	}
	/**
	 * Dependeny Injection
	 */
	public void setThemeService(IThemeService themeService) {
		this.themeService = themeService;
	}


}
